<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Rules_model extends MY_Model {

	public function add($data = NULL) {
		$query = $this->add_data('crawl_rules', $data, true);
		return $query;
	}

	public function edit($ruleid, $data) {
		$result = $this->db->update('crawl_rules', $data, array('id'=>$ruleid));
		return $result;
	}

	public function get_reles() {
		$data = $this->db->select('id,rule_title,startUrl,create_at,disabled')
				->from('crawl_rules')
				->order_by('update_at', 'desc')
				->get()
				->result_array();

		return $data;
	}

	public function show($ruleid) {
		$rule = $this->db->get_where('crawl_rules', array('id' => $ruleid))
					->row_array();
		return $rule;
	}

}